<?php

/*

  Action - Attack	$4

  Each other player discards the top card of his deck, then gains a Curse card, putting it on top of his deck.

 */

class SeaHag extends Card implements iAction, iKingdom, iAttack, iSeaside {

    public function __construct() {
        parent::__construct("Sea Hag", 4);
        $this->undoPlay = false;
        $this->undoBuy = true;
        $this->undoPlay = false;
        $this->undoBuy = true;
    }

    public function getDescription() {
        return array(
            "Each other player discards the top card of his deck, then gains a Curse card, putting it on top of his deck.");
    }
    
    public function play(Game $game, $isRealCard) {
        $game->attack($this);

        $names = $game->getOtherPlayersNames(true);
        foreach ($names as $name) {
            $discarded_cards = $game->discardCardsFromDrawDeck(1, $name);
            $curse = $game->moveCardFromPileToPile("Curse", BoardCards, DrawPile, $name);
             ScreenDisplay::addScreenMessage($game, true, "discard  " . nicePrint($discarded_cards). " and gains ".  nicePrint($curse). " on top of your deck", 
                    "discards  " . sizeof($discarded_cards). " cards and gains ".  nicePrint($curse). " on top of his deck", $name);
        }
        $game->cardActionFinished();
        return true;
    }

}

?>